import request from '@/config/axios'

export interface microCopyrightVO {
  id: number
  name: string
  type: string
  copyrightNumber: string
  copyrightValidity: string
  copyrightStatus: string
  copyrightAuthor: string
  validity: string
}

export interface CopyrightMicroResources {
  id: number
  type: number
  metaId: number
  resourceId: number
  copyrightId: number
}

export interface UpdateStatusReqVO {
  id: number
  status: number
}
// 查看版权条数
export const microCopyrightCount = async (id: string) => {
  return await request.get({ url: '/copyrightMicro-micro/count?id=' + id })
}

// 查询列表
export const getMicroCopyrightPage = async (params: PageParam) => {
  return await request.get({ url: '/copyrightMicro-micro/page', params })
}

// 查询版权详情
export const getCopyright = async (id) => {
  return await request.get({ url: '/copyrightMicro-micro/get?id=' + id })
}

// 新增版权
export const createCopyright = async (data: any) => {
  return await request.post({ url: '/copyrightMicro-micro/create', data })
}

// 删除微版权
export const deleteMicroCopyright = async (id: number) => {
  return await request.delete({ url: '/copyrightMicro-micro/delete?id=' + id })
}

// 修改版权
export const updateCopyright = async (data: any) => {
  return await request.put({ url: '/copyrightMicro-micro/update', data })
}

// 获取过期资源列表
export const getCopyrightExpire = async (params: PageParam) => {
  return await request.get({ url: '/copyrightMicro-micro/expire', params })
}

// 获取资源信息列表
export const getMicroCopyrightResources = async (id) => {
  return await request.get({
    url: '/copyrightMicro-micro-resources/findList?id=' + id
  })
}

// 新增版权资源
export const createCopyrightResources = async (data: any) => {
  return await request.post({ url: '/copyrightMicro-micro-resources/createResources', data })
}
